import { Component, OnInit ,Input} from '@angular/core';
import { Router} from '@angular/router';
import { Http} from '@angular/http';
import { Observable } from 'rxjs';
import { Question } from '../question';
import { QuestionsService } from '../service/questions.service';
import { AnswerQuestionComponent } from '../answer-question/answer-question.component';

@Component({
  selector: 'app-home-page',
  templateUrl: './home-page.component.html',
  styleUrls: ['./home-page.component.css']
})
export class HomePageComponent implements OnInit {
  
  num: number;

  constructor(private router: Router, private questionsService: QuestionsService) { }

  onClickToAnswerQuestion(value: any) {

    if(value=="科技"){
      this.num = 1;
      alert("即将开启科技模块答题");
    }else if(value=="外交"){
      this.num = 11;
      alert("即将开启外交模块答题");
    }else if(value=="经济"){
      this.num = 21;
      alert("即将开启育模块答题");
    }else if(value=="文娱"){
      this.num = 31;
      alert("即将开启文娱模块答题");
    }
    this.router.navigate(['home/answerquestion/' + this.num]);
  }

  ngOnInit() {
  }
}
